//================================================================================================================
// This file consists of patches for the general10.fx shader. These are turned on or off by the PatchOptions.fxh
// Please don't edit this file!
//
// version 2.0 Fixes to runways flahing + opaque fences. + Progressive taxi
//================================================================================================================

#include




//================================================================================================================
// Test Shader options and set flags that indicate if this is a shader we want to try and change

#if defined(VT_VERTEX) && defined(SHD_DOUBLE_SIDED) && defined(SHD_BASE) && !defined(SHD_PRELIT) && !defined(SHADOWMAP) && !defined(SHD_ADDITIVE_EMISSIVEMAP) && !defined(SHD_ALPHA_TEST) && !defined(SHD_SHADOWMAP)
#define FENCE_SHADER 1
#endif


#if defined(VT_VERTEX) && defined(SHD_VERTICAL_NORMAL) && defined(SHD_BASE) && defined(SHD_ENV) && defined(SHD_PRECIP_BLEND)
#define AIRPORT_SHADER
#endif


#if defined(AIRPORT_SHADER) && defined(SHD_BLENDENVBYINVBASEALPHA) && defined(SHD_FINAL_ALPHA_BLEND)
#define MARKINGS_SHADER
#endif


#if defined(AIRPORT_SHADER) && defined(SHD_DETAIL) && defined(SHD_BUMP)
#define RUNWAY_SHADER
#endif

#if defined(VT_VERTEXCOL) && defined(SHD_BASE) && defined(SHD_PRELIT) && defined(SHD_DOUBLE_SIDED)
#define PROG_TAXI_SHADER
#endif



//================================================================================================================
// define DX10 State change objects - these are only defined if both the patch is enabled and the condition is met
// Note that I am trying to avoid any changes at all to shaders that dont meet the conditions.

#if PROG_TAXI_PATCH == 1 && defined(PROG_TAXI_SHADER)
BlendState ForceOne
{

SrcBlend = 6;


};
#endif


#if OPAQUE_FENCES_PATCH == 1 && defined(FENCE_SHADER)
BlendState Enable
{

BlendEnable[0] = TRUE;
SrcBlend = 5;
DestBlend = 6;


};
#endif

#if (MARKINGS_PATCH == 1 && defined(MARKINGS_SHADER)) || (TAXIWAY_PATCH == 1 && defined(RUNWAY_SHADER))
DepthStencilState ZWriteOff
{

DepthWriteMask = ZERO;

};
#endif



//===============================================================================================================
// replacement technique block - this calls state changes - again the call is only made if the patch is enaabled
// and the shader signature matches.

technique10 T0
{
pass P0
{
SetVertexShader(CompileShader(vs_4_0, VS()));
SetGeometryShader(NULL);
SetPixelShader(CompileShader(ps_4_0, PS()));

#if (MARKINGS_PATCH == 1 && defined(MARKINGS_SHADER)) || (TAXIWAY_PATCH == 1 && defined(RUNWAY_SHADER))
SetDepthStencilState(ZWriteOff,0);
#endif
#if PROG_TAXI_PATCH == 1 && defined(PROG_TAXI_SHADER)
SetBlendState(ForceOne,float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF);
#endif

#if OPAQUE_FENCES_PATCH == 1 && defined(FENCE_SHADER)
SetBlendState(Enable,float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF);
#endif
}
}